import random
from datetime import datetime, date


def get_color():
    # 获取随机颜色
    get_colors = lambda n: list(map(lambda i: "#" + "%06x" % random.randint(0, 0xFFFFFF), range(n)))
    color_list = get_colors(100)
    return random.choice(color_list)


def get_time(time):
    time_1_struct = datetime.strptime(time, "%Y-%m-%d %H:%M:%S")
    time_2_struct = datetime.now()
    total_seconds = (time_2_struct - time_1_struct).total_seconds()
    return int(total_seconds / 60 / 60 / 24)
